package com.cloud.class04.test;

public interface Person {
    void eat();
}

class Test {
//    class Student implements Person {
//        @Override
//        public void eat() {
//            System.out.println("吃饭");
//        }
//    }

    public static void test(Person person) {
        person.eat();
    }


    public static Person getPerson() {
        Person person = new Person() {
            @Override
            public void eat() {
                System.out.println("吃饭");
            }
        };
        return person;
    }

    public static void main(String[] args) {
        test(new Person() {
            @Override
            public void eat() {
                System.out.println("吃饭");
            }
        });

        Person person = () -> {
            System.out.println("吃饭");
        };
        Runnable runnable = () -> {
            System.out.println("线程启动");
        };
        Runnable runnable1 = new Runnable() {
            @Override
            public void run() {
                System.out.println("线程启动");
            }
        };
//        方法重写的前提：
//        必须建立实现或继承关系上
//        1.方法名相同 2.参数列表相同 3.返回值相同
//        权限修饰符：必须满足子类权限大于父类权限


    }


}
